package vn.vfriends.vbox.rest;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.annotation.PostConstruct;
//import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author tuancn
 */
//@Startup
@Singleton
public class ApiConfigLoader {

    private static final Logger logger = LoggerFactory.getLogger(ApiConfigLoader.class);

    private Properties properties;

    @PostConstruct
    private void init() {
        try {
            InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("api.properties");
            properties = new Properties();
            properties.load(inputStream);
        } catch (IOException e) {
            logger.error(e.getMessage(), e);
        }
    }

    public Properties getProperties() {
        return properties;
    }
}
